package com.avic.modules.record.rest;

import com.avic.modules.record.domain.ContinuousOptimize;
import com.avic.modules.record.service.ContinuousOptimizeService;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhangzikang
 * @date 2023-09-4
 */
@RestController
@RequestMapping("/api/continuous/optimize")
@AllArgsConstructor
public class ContinuousOptimizeController {

    private final ContinuousOptimizeService continuousOptimizeService;


    /**
     * 查询最新信息
     * @return
     */
    @GetMapping
    public ResponseEntity<Object> queryContinuousOptimize(){

        return new ResponseEntity<>(continuousOptimizeService.queryContinuousOptimize(), HttpStatus.OK);
    }

    /**
     * 查询最新信息
     * @return
     */
    @PutMapping
    public ResponseEntity<Object> editContinuousOptimize(@Validated @RequestBody ContinuousOptimize continuousOptimize){
        continuousOptimizeService.editContinuousOptimize(continuousOptimize);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
